<template>
	<view class="passenger-flow">
		<view class="con-1">
			<nav-bar title="场地管理" color="white" bg="rgba(0,0,0,0)"></nav-bar>
			<view class="bg">
				<view class="address">
					<view class="flex-space-between">
						<view class="flex-align">
							<van-image v-if="itemChooselist.venue_thumb != ''" width="74rpx" height="74rpx" radius="2"
								style="margin-right: 10rpx;" :src="itemChooselist.venue_thumb" />
							<van-image v-else width="74rpx" height="74rpx" radius="10rpx" fit="cover" style="margin-right: 10rpx;" src="https://img.yzcdn.cn/vant/cat.jpeg" />
							<view>
								<view class="address-name">{{itemChooselist.venue_name}}</view>
								<view class="address-desc">地址:{{itemChooselist.address}}</view>
							</view>
						</view>
						<view class="exchange flex-center flex-column " @click="show_no">
							<van-icon name="exchange" size="16" />
							切换
						</view>
					</view>
				</view>
			</view>
		</view>

		<!-- <view class="" style="position: absolute;z-index: 10;top: 20vh;width: 100vw;">
			<u-sticky>
				<u-tabs :list="tabsList_s" lineColor="#FF4040" :activeStyle="{
								color: '#000000'
							}" :inactiveStyle="{
								color: '#353535'
							}" :lineWidth="30" :current="current_Tab" @click="onClickTab" />
			</u-sticky>
		</view> -->

		<view class="box-2">
			<!-- 场地预约 -->
			<view class="data-list10">
				<scroll-view scroll-y class="scroll"
					style="position: absolute;z-index: 999;top: 24vh;width: 95vw;height: 72vh;">
					<view class="data-item flex-between" style="margin-top: 20rpx;" v-for="(item, index) in products2"
						:key="index" @click="cdxq(item,index)">
						<view class="flex-align" style="height: 100%">
							<view class="image" @click="addclick">
								<image style="width: 156rpx;height: 154rpx;" mode="aspectFill" :src="item.picture">
								</image>
							</view>

							<view class="detail" @click="addclick">
								<view class="title">{{item.name}}</view>
								<view>
									<view class="tag-list flex-align" v-if="item.projects != ''">
										<!-- <view class="tag" v-for="(im, ix) in item.venues_project" :key="index" >{{im.name}}</view> -->
										<view v-if="item.projects[0].name != undefined" class="tag">
											{{item.projects[0].name}}
										</view>
										<view v-if="item.projects[1].name != undefined" class="tag">
											{{item.projects[1].name}}
										</view>
										<view v-if="item.projects[2].name != undefined" class="tag">
											{{item.projects[2].name}}
										</view>
										<view v-if="item.projects[3].name != undefined" class="tag">
											{{item.projects[3].name}}
										</view>
									</view>
									<view class="detail-info" v-if="item.dtPrice != ''">￥{{item.min_price}}/起
									</view>
								</view>
							</view>
						</view>

						<!-- <view class="btn">去预约</view> -->
						<!-- <view class="" style="position: absolute;right: 20rpx;top: 30rpx;">
							<image src="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/c154ba8794158495ff83ed092dc0fad167ff2406.png" style="width: 60rpx;height: 30rpx;"
								mode=""></image>
						</view> -->
						<!-- <view class="" style="position: absolute;right: 30rpx;top:40rpx;">
							<image @click="showsclick(item,index)"
								src="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/c154ba8794158495ff83ed092dc0fad167ff2406.png"
								style="width: 80rpx;height: 40rpx;" mode=""></image>
						</view> -->
						<!-- <view class="box_20" v-if="index == shows0">
							<view class="image-text_4" v-if="current_Tab == 1" @click="shangjia(item,index)">
								<image
									src="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/b2eb5628428653b3a52f4cc5b29f58fcdbde4fb0.png"
									class="icon_5"></image>
								<text lines="1" class="text-group_4">上架</text>
							</view>
							<view class="image-text_4" v-if="current_Tab == 0" @click="xiajia(item,index)">
								<image
									src="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/a87a0cfb6f2be1f8888d72799caf91e10adca833.png"
									class="icon_5"></image>
								<text lines="1" class="text-group_4">下架</text>
							</view>
							<view class="image-text_6" @click="xiangqing(item,index)">
								<image
									src="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/35c39fca1bbdb7af38900601c32403dff06abac6.png"
									class="icon_7"></image>
								<text lines="1" class="text-group_6">详情</text>
							</view>
							<view class="image-text_7" @click="cdxq(item,index)">
								<image
									src="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/35c39fca1bbdb7af38900601c32403dff06abac6.png"
									class="icon_7"></image>
								<text lines="1" class="text-group_6">场地</text>
							</view>
							<image
								src="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/f820809dedb1e84b45f4b46e359e3ad308af5541.png"
								class="image_4"></image>
						</view> -->
					</view>
				</scroll-view>
			</view>
		</view>

		<van-popup closeable :show="show" round position="bottom" get-container="body" @close="showclose"
			:z-index='9999'>
			<view class="good-box">
				<view class="title">
					切换场馆
				</view>
				<view class="good-list">
					<view class="good-item" v-for="(item,index) in venuelist" :key="index" @click="onChangelist(item)">
						<view class="flex-align">
							<van-image width="124rpx" height="124rpx" radius="10rpx" fit="cover"
								v-if="item.venue_thumb != ''" :src="item.venue_thumb" />
							<van-image v-else width="124rpx" height="124rpx" radius="10rpx" fit="cover"
								src="https://img.yzcdn.cn/vant/cat.jpeg" />

							<view class="info">
								<view class="name">{{item.venue_name}}</view>
								<view class="flex-align" v-if="item.project_list != ''">
									<view class="tag" v-if="item.project_list[0].name != ''">
										{{item.project_list[0].name}}
									</view>
									<view class="tag" v-if="item.project_list[1].name != '' && item.project_list[1]">
										{{item.project_list[1].name}}
									</view>
									<view class="tag" v-if="item.project_list[2].name != ''&& item.project_list[2]">
										{{item.project_list[2].name}}
									</view>
								</view>
								<view class="address">{{item.address}}</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</van-popup>
	</view>
</template>

<script>
	const personal = require("@/api/personal/index.js");
	export default {
		data() {
			return {
				lineChartData: {},
				show: false,
				venuelist: [], //场馆列表
				itemChoose: {}, // 场馆数据
				itemChooselist: {}, // 场馆数据
				showlist: true,
				week_num: '', //本周客流
				month_num: '', //本月客流
				history_num: '', //历史客流
				nac: '',
				products0: [],
				products1: [],
				products2: [],
				products3: [],
				products8: [{
					race_name: "苏州市2023春季小学生游泳公开赛",
					show_img: "https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/5c/98fc62e61a777be3b1aeea17c950b8.jpg?attname=%E8%BF%90%E5%8A%A8%60%E4%B8%8D%E6%AD%A2+%2817%29.jpg",
					subtitle: "游泳比赛小学生"
				}],
				menuActive: ' 0',
				inventorylist: "",
				typelist: "",
				card_type: "",
				tabsList_s: [{
					name: '已上架'
				}, {
					name: '未上架'
				}, {
					name: '超期下架'
				}],
				current_Tab: 0,
				shows0: -1,
				currentTab: 1,
				over: 0
			}
		},
		onLoad(options) {
			// this.menuActive = options.index
			// this.inventorylist = options.inventory
			// this.typelist = options.type
			// this.card_type = options.card_type
			var data = uni.getStorageSync("wqzdy");
			var items = JSON.parse(data)
			this.venuelist = items
			this.itemChooselist = this.venuelist[0]
			if (uni.getStorageSync("entry_name") == '') {
				uni.showToast({
					title: '请登录！',
					icon: 'exception',
					duration: 850
				});
				setTimeout(() => {
					uni.navigateTo({
						url: '/pages/my-center/my-center'
					})
				}, 1000);
			}
			this.admin_index()
		},
		onShow() {
			this.admin_index()
			this.shows0 = -1
		},
		methods: {
			addclick() {
				this.shows0 = -1
			},
			async admin_index() {
				let that = this
				let params = {
					venue_id: this.itemChooselist.id,
					type: '3',
					// inventory: this.inventorylist,
					// card_type: this.card_type,
					status: this.currentTab,
					over: this.over
				};
				let res = await personal.product_list(params);
				if (res.code == 1) {
					that.products2 = res.data
				}
			},
			// 详情
			xiangqing(item, index) {
				uni.navigateTo({
					url: './product_detailss?typelist=' + this.typelist + "&id=" + item.id + "&currentTab=" + this
						.currentTab + "&over=" + this.over
				})
			},
			cdxq(item, index) {
				uni.navigateTo({
					url: '../stadium/stadium?typelist=' + this.typelist + "&id=" + item.id + "&currentTab=" + this
						.currentTab + "&over=" + this.over + "&venue_id=" + this.itemChooselist.id + "&name=" +
						item.name
				})
			},

			showsclick(item, index) {
				this.shows0 = index
			},

			onClickTab({
				index
			}) {
				this.products0 = []
				this.products1 = []
				this.products2 = []
				this.products3 = []
				this.products8 = []
				this.current_Tab = index;
				if (index == 0) {
					this.currentTab = 1;
					this.over = 0
				} else if (index == 1) {
					this.currentTab = 0;
					this.over = 0
				} else if (index == 2) {
					this.currentTab = 0;
					this.over = 1
				}
				this.shows0 = -1
				this.admin_index()
			},
			// 选择场馆
			onChange(e) {
				let that = this
				let i = e.detail
				const item = this.venuelist[i]
				if (item) {
					this.itemChoose = item
					this.venuelist[i].checked = true
				} else {
					this.itemChoose = {}
				}
			},
			onChangelist(item) {
				this.itemChoose = item
				this.lineChartData = []
				this.itemChooselist = this.itemChoose
				this.show = false
				this.showlist = true
				this.dateActive = '5'
				this.nac = '5'
				this.admin_index()
			},
			// 确认按钮
			queren() {
				this.lineChartData = []
				this.itemChooselist = this.itemChoose
				this.show = false
				this.showlist = true
				this.dateActive = '5'
				this.nac = '5'
				this.admin_index()
			},
			show_no() {
				this.show = true
				this.showlist = false
			},
			showclose() {
				this.show = false
				this.showlist = true
			}
		}
	}
</script>

<style lang="scss" scoped>
	.passenger-flow {
		width: 100%;
		height: 100vh;
		display: flex;
		flex-direction: column;
		background-color: rgb(243, 243, 243);
		padding: 0rpx 0 50rpx 0;
		position: relative;

		.con-1 {
			width: 100%;
			position: relative;

			/deep/ .nav-bar {
				position: fixed;
				z-index: 999;
			}

			.bg {
				width: 100%;
				height: 400rpx;
				background-image: url("https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/b06d5082b279372c5e22b6c40432135f7fdca194.png");
				background-size: 100%;
				background-position: 50% 80%;
				position: fixed;
				z-index: 9;

				.address {
					color: #fff;
					padding-top: 190rpx;
					padding-right: 30rpx;
					padding-left: 30rpx;
					height: 150rpx;

					&-name {
						font-size: 32rpx;
						font-weight: 700;
						line-height: 34rpx;
					}

					&-desc {
						margin-top: 18rpx;
						font-size: 22rpx;
						line-height: 22rpx;
					}

					.exchange {
						width: 100rpx;
						height: 100rpx;
						border-radius: 50%;
						background-color: rgba(0, 0, 0, 0.2);
						color: rgb(234, 248, 248);
						font-size: 24rpx;
					}
				}
			}
		}

		/deep/ .good-box {
			height: 60vh;
			padding: 0px 30rpx;
			display: flex;
			flex-direction: column;

			.title {
				color: #000;
				font-size: 30rpx;
				font-weight: 700;
				margin-top: 40rpx;
			}

			.van-radio__label {
				line-height: inherit;
			}

			.good-list {
				flex: 1;
				height: 0;
				overflow: auto;

				.good-item {
					margin-top: 30rpx;

					.info {
						margin-left: 25rpx;

						.address {
							color: #fff;
							padding-top: 20rpx;
							padding-right: 30rpx;
							height: 70rpx;

							&-name {
								font-size: 34rpx;
								font-weight: 700;
								line-height: 34rpx;
							}

							&-desc {
								margin-top: 18rpx;
								font-size: 22rpx;
								line-height: 22rpx;
							}

							.exchange {
								width: 100rpx;
								height: 100rpx;
								border-radius: 50%;
								background-color: rgba(0, 0, 0, 0.2);
								color: rgb(234, 248, 248);
								font-size: 24rpx;
							}
						}

						.name {
							color: rgb(51, 51, 51);
							font-size: 30rpx;
							font-weight: 500;
							margin-bottom: 10rpx;
						}


						.tag {
							color: rgb(4, 179, 90);
							font-size: 24rpx;
							font-weight: 500;
							padding: 0px 10rpx;
							margin-right: 20rpx;
							background-color: rgba(4, 179, 90, 0.2);
							border-radius: 4rpx;

							&:nth-of-type(2) {
								color: rgb(236, 70, 246);
								background-color: rgba(236, 70, 246, 0.2);
							}
						}

						.address {
							margin-top: 10rpx;
							color: rgb(136, 136, 136);
							font-size: 22rpx;
						}
					}

				}
			}

			.footer {
				padding: 20rpx 0;
				background-color: rgb(255, 255, 255);

				.btn {
					color: rgb(255, 255, 255);
					font-size: 30rpx;
					font-weight: 700;
					padding: 20rpx 0;
					text-align: center;
					background-image: linear-gradient(0deg, rgb(99, 93, 247) 0%, rgb(165, 173, 246) 100%);
					border-radius: 60rpx;
				}
			}
		}

		.title {
			font-size: 28rpx;
			font-weight: 700;
		}

		.box-2 {
			padding: 0px 10rpx;
			margin-left: 10rpx;
			flex: 1;
			height: 0;
			display: flex;
			flex-direction: column;
			box-sizing: border-box;
			transform: translateY(-60rpx);

			>view {
				flex: 1;
				height: 0;

				.scroll {
					// height: calc(100% - 40rpx);
					height: 100%;
				}
			}

			.data-list10 {
				.data-item {
					width: 100%;
					height: 180rpx;
					border-bottom: solid 2rpx rgb(229, 229, 229);
					// padding-bottom: 20rpx;/*  */
					margin-bottom: 20rpx;
					background-color: #ffffff;
					border: 0.1rpx linear-gradient(190deg, #FFF, #FFF) solid;
					border-radius: 10rpx;
					box-shadow: 0rpx 0rpx 9rpx 1rpx rgba(0, 0, 0, 0.06);
					position: relative;
					padding: 20rpx;
					// &:last-of-type {
					// 	margin-bottom: 0;
					// 	padding-bottom: 0;
					// }

					.box_20 {
						background-color: rgba(0, 0, 0, 1);
						border-radius: 10rpx;
						position: absolute;
						width: 235rpx;
						height: 105rpx;
						flex-direction: row;
						display: flex;
						right: 35rpx;
						top: 90rpx;
						z-index: 99;

						.image-text_4 {
							width: 34rpx;
							height: 62rpx;
							display: flex;
							flex-direction: column;
							justify-content: space-between;
							margin: 20rpx 0 0 28rpx;
						}

						.icon_5 {
							width: 30rpx;
							height: 30rpx;
							margin-left: 2rpx;
						}

						.text-group_4 {
							width: 34rpx;
							height: 18rpx;
							overflow-wrap: break-word;
							color: rgba(255, 255, 255, 1);
							font-size: 18rpx;
							font-family: PingFang-SC-Medium;
							font-weight: 500;
							text-align: left;
							white-space: nowrap;
							line-height: 24rpx;
							margin-top: 14rpx;
						}

						.image-text_5 {
							width: 36rpx;
							height: 65rpx;
							display: flex;
							flex-direction: column;
							justify-content: space-between;
							margin: 17rpx 0 0 37rpx;
						}

						.icon_67 {
							width: 32rpx;
							height: 32rpx;
							margin-left: 2rpx;
						}

						.text-group_5 {
							width: 36rpx;
							height: 18rpx;
							overflow-wrap: break-word;
							color: rgba(255, 255, 255, 1);
							font-size: 18rpx;
							font-family: PingFang-SC-Medium;
							font-weight: 500;
							text-align: left;
							white-space: nowrap;
							line-height: 24rpx;
							margin-top: 15rpx;
						}

						.image-text_6 {
							width: 36rpx;
							height: 65rpx;
							display: flex;
							flex-direction: column;
							justify-content: space-between;
							margin: 18rpx 0 0 37rpx;
						}

						.image-text_7 {
							width: 36rpx;
							height: 65rpx;
							display: flex;
							flex-direction: column;
							justify-content: space-between;
							margin: 18rpx 0 0 37rpx;
						}

						.icon_7 {
							width: 32rpx;
							height: 32rpx;
							margin-left: 2rpx;
						}

						.text-group_6 {
							width: 36rpx;
							height: 18rpx;
							overflow-wrap: break-word;
							color: rgba(255, 255, 255, 1);
							font-size: 18rpx;
							font-family: PingFang-SC-Medium;
							font-weight: 500;
							text-align: left;
							white-space: nowrap;
							line-height: 24rpx;
							margin-top: 15rpx;
						}

						.image_4 {
							position: absolute;
							left: 125rpx;
							top: -13rpx;
							width: 28rpx;
							height: 14rpx;
						}
					}

					.image {
						width: 156rpx;
						height: 154rpx;
						border-radius: 5px;
						// overflow: hidden;

						image {
							width: 100%;
							height: 100%;
						}
					}

					.detail {
						display: flex;
						margin-left: 20rpx;
						height: 100%;
						flex-direction: column;
						justify-content: space-between;

						.tag-list {
							margin-bottom: 20rpx;

							.tag {
								font-size: 22rpx;
								border-radius: 10rpx;
								padding: 5rpx 10rpx;
								color: white;
								background-color: #abc6fa;
								margin-right: 10rpx;
							}
						}

						.detail-info {
							color: rgb(255, 65, 5);
							font-size: 30rpx;
							font-weight: 700;

							&:first-of-type {
								margin-bottom: 7rpx;
							}
						}
					}

					.btn {
						border-radius: 8px;
						color: white;
						padding: 10rpx 25rpx;
						font-size: 25rpx;
						background-image: linear-gradient(0deg,
								rgb(47, 117, 250) 0%,
								rgb(82, 142, 255) 100%);
						margin-top: 20rpx;
					}
				}
			}

		}

	}
</style>